/**
 * Created by cj on 2017/5/6.
 */

(function () {
    var CarManager = {
        //request information
        requestInfo:function (model,id) {
            return "The infomation for " +model + " with ID " + id + " is foobar";
        },
        //purchase the car
        buyVehicle:function (model,id) {
            return "You have successfully purchased Item "+id + ",a" + model;
        },
        //arrange a viewing
        arrangeViewing:function (model,id) {
            return "You have successfully booked a viewing of "+model +"(" + id + ")";
        }
    };
    CarManager.execute =function (name) {
        console.log(CarManager[name]);
        return CarManager[name] && CarManager[name].apply(CarManager,[].slice.call(arguments,1));
    }
    window.CarManager=CarManager;
})();